package com.wlyuan.open.domain.mappings;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.wlyuan.open.domain.*;

/**
 * @author
 * 对接表
 */
public class MappingPush {

    public Long createPushTaskId(PushTaskId pushTaskId){
        return pushTaskId.getId();
    }

    public PushTaskId createPushTaskId(Long pushTaskId){
        return new PushTaskId(pushTaskId);
    }

    public Long createPushTenantId(PushTenantId pushTenantId){
        return pushTenantId.getId();
    }

    public PushTenantId createPushTenantId(Long id){
        return new PushTenantId(id);
    }

    public PushType createPushType(Integer pushType){
        return PushType.fromValue(pushType);
    }

    public Integer createPushType(PushType pushType){
        return pushType.getValue();
    }

    public PushBusinessType createBusinessType(Integer businessType){
        return PushBusinessType.fromValue(businessType);
    }

    public Integer createBusinessType(PushBusinessType businessType){
        return businessType.getValue();
    }

    public JSONObject parseObject(String jsonString){
        if(jsonString!=null) {
            return JSON.parseObject(jsonString);
        }
        return null;
    }

    public String toJSONString(JSONObject jsonObject){
        if(jsonObject!=null) {
            return jsonObject.toJSONString();
        }
        return null;
    }

    public PushTaskStatus createPushTaskStatus(Integer value){
        return PushTaskStatus.fromValue(value);
    }

    public Integer createPushTaskStatus(PushTaskStatus status){
        return status.getValue();
    }
}
